package zsxking.batchfilerenamer;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;

/**
 * Panel for status information.
 * @author Shaoxuan Zhang
 *
 */
public class StatusPanel extends JPanel {

  /** Support serialization. */
  private static final long serialVersionUID = -1774720403142857678L;
  private JLabel messageLabel;
  
  /**
   * Create the panel with proper GUI component.
   */
  public StatusPanel() {

    super(new MigLayout(BatchFileRenamerGui.LAYOUT_MODE, // Layout Constraints 
                        "rel[right,grow,fill]rel",  // Column constraints 
                        "rel[15]rel")                       // Row constraints
    );
    
    messageLabel = new JLabel();
    messageLabel.setName("status");
    this.add(messageLabel);
  }
  
  /**
   * Draw a line on top of the panel.
   * @param g graphics to draw.
   */
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g); 

    Graphics2D g2d = (Graphics2D) g;

    g2d.setColor(Color.gray);
    g2d.drawLine(0, 0, (int)getSize().getWidth(), 0);
    
  } 

  
  /**
   * @param message the message to display in this status panel.
   */
  public void setMessage(String message) {
    messageLabel.setText(message);
  }
  
  
}
